//
//  PayStyleCell.m
//  sensen_ios
//
//  Created by pro on 16/2/27.
//  Copyright © 2016年 pro. All rights reserved.
//

#import "PayStyleCell.h"

#define cell_width self.contentView.width
#define cell_height self.contentView.height

@interface PayStyleCell ()



@end

@implementation PayStyleCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
    if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        
        self.selectionStyle = UITableViewCellSelectionStyleNone;
        
        self.contentView.width = SCREEN_WIDTH;
        self.contentView.height = 50;
        [self _initViews];
    }
    
    return self;
}


#pragma mark -- 创建视图 --
- (void)_initViews {
    
    CGFloat x, y, width, height;
    
    x = 15;
    width = 25;
    height = width;
    _iconView = [[UIImageView alloc] initWithFrame:CGRectMake(x, y, width, height)];
    [self.contentView addSubview:_iconView];
    _iconView.center = CGPointMake(_iconView.center.x, cell_height / 2);

    // 标题
    x = _iconView.right + 10;
    width = 100;
    height = 20;
    _titleLabel = [[UILabel alloc] initWithFrame:CGRectMake(x, y, width, height)];
    _titleLabel.font = FONT(15);
    _titleLabel.text = @"标题";
    _titleLabel.textColor = [UIColor darkGrayColor];
    _titleLabel.textAlignment = NSTextAlignmentLeft;
    [self.contentView addSubview:_titleLabel];
    _titleLabel.center = CGPointMake(_titleLabel.center.x, cell_height / 2);
    
    width = 20;
    height = width;
    _selectButton = [UIButton buttonWithType:UIButtonTypeCustom];
    _selectButton.frame = CGRectMake(x, y, width, height);
    [_selectButton setBackgroundImage:[UIImage imageNamed:@"付款详情_未选中"] forState:UIControlStateNormal];
    [_selectButton setBackgroundImage:[UIImage imageNamed:@"付款详情_选中"] forState:UIControlStateSelected];
    [_selectButton addTarget:self action:@selector(_selectAction:) forControlEvents:UIControlEventTouchUpInside];
    [self.contentView addSubview:_selectButton];
    _selectButton.right = cell_width - 20;
    _selectButton.center = CGPointMake(_selectButton.center.x, cell_height / 2);
}


#pragma mark - 点击事件
- (void)_selectAction:(UIButton *)button {
//    button.selected = !button.selected;
}

@end
